﻿using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;

namespace Marmat.Forms
{
    internal partial class InputValueForm : Form
    {

        internal EditControl Sender_0;

        public InputValueForm(object variant, bool password)
        {

            // 此调用是设计器所必需的。
            this.InitializeComponent();

            // 在 InitializeComponent() 调用之后添加任何初始化。
            if (variant is DateTime)
            {
                this.Sender_0 = new DateTimePicker();
            }
            else if (variant is int)
            {
                this.Sender_0 = new NumericBox() { EditMask = "n0" };
            }
            else if (variant is float || variant is double || variant is decimal)
            {
                this.Sender_0 = new NumericBox();
            }
            else if (variant is string)
            {
                this.Sender_0 = new TextBox() { UseSystemPasswordChar = password };
            }
            else
            {
                this.Sender_0 = new TextBox();
            }

            if (this.Sender_0 is EditControl control)
            {
                control.Location = new Point(20, 90);
                control.Size = new Size(400, 21);
                control.ShowCaption = false;
                this.Controls.Add((Control)this.Sender_0);
                control.Select();
                control.Value = variant;
            }
        }
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
    }
}